package com.zq.it.service.exam;

import java.util.List;
import java.util.Map;

import com.zq.it.dao.common.PageConfig;
import com.zq.it.pojo.Student;
import com.zq.it.pojo.Teacher;
import com.zq.it.pojo.exam.TClassPaper;
import com.zq.it.pojo.exam.TExamResult;
import com.zq.it.pojo.exam.TPaper;
import com.zq.it.pojo.exam.TPaperDetail;
import com.zq.it.pojo.exam.data.ObjectData;
import com.zq.it.pojo.exam.data.PaperData;
import com.zq.it.service.BaseService;

public interface PaperService extends BaseService {

	/**
	 * 增加试卷
	 * 
	 * @param teacher
	 * @param paper
	 * @param rand_qtype
	 * @param rand_perscore
	 * @param rand_nums
	 * @param rand_dbid
	 */
	public void addPaper(Teacher teacher, TPaper paper, String[] rand_cname,
			String[] rand_dbid, String[] rand_nums, String[] rand_perscore,
			String[] rand_qtype);

	/**
	 * 根据试卷id获取试卷(带教师验证)
	 * 
	 * @param id
	 * @param teacher
	 * @return
	 */
	TPaper getPaperById(String id, Teacher teacher);

	/**
	 * 根据试卷id获取试卷
	 * 
	 * @param id
	 * @param teacher
	 * @return
	 */
	public TPaper getPaperById(String id);

	/**
	 * 修改试卷信息
	 * 
	 * @param teacher
	 * @param paper
	 * @param rand_qtype
	 * @param rand_perscore
	 * @param rand_nums
	 * @param rand_dbid
	 * @param rand_cname
	 */
	void updatePaper(Teacher teacher, TPaper paper, String[] rand_cname,
			String[] rand_dbid, String[] rand_nums, String[] rand_perscore,
			String[] rand_qtype);

	/**
	 * 获取试卷详情(带教师验证)
	 * 
	 * @param paper
	 * @param teacher
	 * @return
	 */
	List getPaperDetails(TPaper paper, Teacher teacher);

	/**
	 * 获取试卷详情
	 * 
	 * @param paper
	 * @param teacher
	 * @return
	 */
	public List<TPaperDetail> getPaperDetails(long paperId);

	/**
	 * 获取试卷章节设置
	 * 
	 * @param id
	 * @return
	 */
	public List getPaperSections(long id);

	/**
	 * 根据条件拼接hql语句
	 * 
	 * @param teacher
	 * @param rand_cname
	 * @param rand_dbid
	 * @param rand_qtype
	 */
	public String createQuestionHql(Teacher teacher, String[] rand_cname,
			String[] rand_dbid, String[] rand_qtype);

	/**
	 * 更新试卷详情
	 * 
	 * @param teacher
	 * @param id
	 * @param sid
	 * @param qid
	 * @param qscore
	 */
	public boolean updatePaperDetail(Teacher teacher, long id, String[] sid,
			String[] qid, String[] qscore);

	/**
	 * 获取试卷详情
	 * 
	 * @param teacher
	 * @param id
	 * @return
	 */
	public PaperData getPaperData(Teacher teacher, long id);

	/**
	 * 获取已分配的班级列表
	 * 
	 * @param config
	 * @return
	 */
	public ObjectData getAssignClass(PageConfig config);

	/**
	 * 批量分配班级
	 * 
	 * @param id
	 * @param id2
	 * @param teacher
	 */
	public void addClassAssign(String[] id, long id2, Teacher teacher);

	/**
	 * 获取试卷详情
	 * 
	 * @param student
	 * @param id
	 * @return
	 */
	public PaperData getPaperData(Student student, long id);

	/**
	 * 通过分页配置获取已分配考试的班级列表 即：进入试卷评阅页面
	 * 
	 * @param config
	 * @return
	 */
	public ObjectData getExamClassList(PageConfig config);

	/**
	 * 根据id查找考试班级分配详情
	 * 
	 * @param id
	 * @return
	 */
	public TClassPaper findClassPaperById(String id);

	/**
	 * 根据id查找考试班级分配详情
	 * 
	 * @param id
	 * @param teacher
	 * @return
	 */
	public TClassPaper findClassPaperById(String id, Teacher teacher);

	/**
	 * 根据分页配置获取学生考试结果列表
	 * 
	 * @param config
	 * @return
	 */
	public ObjectData getStudentExamRelList(PageConfig config);

	/**
	 * 获取学生试卷的答题详情
	 * 
	 * @param teacher
	 * @param string
	 * @return
	 */
	public Map getPaperResultDetail(Teacher teacher, String string);

	/**
	 * 设置学生的试题分数
	 * 
	 * @param pid
	 * @param uid
	 * @param qid
	 * @param examResultId
	 * @param score
	 * @param teacher
	 * @return
	 */
	public String updateStudentScore(long pid, Long uid, String qid,
			Long examResultId, Long score, Teacher teacher);

	/**
	 * 多条件查询试卷
	 * 
	 * @param paper
	 * @param teacher
	 * @return
	 */
	public String createPaperHql(TPaper paper, Teacher teacher);

	/**
	 * 批量删除试卷
	 * 
	 * @param teacher
	 * @param id
	 * @return
	 */
	public String deletePaper(Teacher teacher, String[] id);

	/**
	 * 多条件查询试卷评阅的hql语句
	 * 
	 * @param classPaper
	 * @param startTime
	 * @param endTime
	 * @param teacher
	 * @return
	 */
	public String createExamClassListHql(TClassPaper classPaper,
			String startTime, String endTime, Teacher teacher);

	/**
	 * 批量删除试卷评阅列表
	 * 
	 * @param teacher
	 * @param id
	 * @return
	 */
	public String deleteExamClassList(Teacher teacher, String[] id);

	/**
	 * 多条件查询批改列表
	 * 
	 * @param examResult
	 * @return
	 */
	public String creatExamResultListHql(TExamResult examResult,
			TClassPaper classPaper);

}
